package bbkj.org.cn.imple;

import org.apache.dubbo.config.annotation.DubboService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import bbkj.org.cn.modle.DemoData;
import bbkj.org.cn.service.MockDemoService;
import bbkj.org.cn.util.DemoUtil;

@Service("mockDemo")
@DubboService
public class MockDemoImple implements MockDemoService{

	private final int min = 20;
	private final int max = 30;
	private final  Logger LOG = LoggerFactory.getLogger(getClass());
	
	@Override
	public DemoData handleData(DemoData data) {
		LOG.info("demoData.name={},num={}",data.getName(),data.getNum());
		
		DemoUtil.handleData(data, min, max);
		
		try {
			LOG.info("休眠3s");
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		LOG.info("处理{}后：num={}",data.getName(),data.getNum());
		return data;
	}

}
